package com.miracle9.game.server.message;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;
import org.apache.mina.filter.codec.demux.MessageEncoder;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class MessageEncoderUtil1 implements MessageEncoder<Object>
{
  private static final Set<Class<?>> E;
  static
  {
    Set<Class<?>> types = new HashSet();
    types.add(IoBuffer.class);
    E = Collections.unmodifiableSet(types);
  }
  
  public void encode(IoSession session, Object message, ProtocolEncoderOutput out)
    throws Exception
  {
    IoBuffer m = (IoBuffer)message;
    if (m == null) {
      return;
    }
    out.write(m);
  }
  
  public Set<Class<?>> returnE()
  {
    return E;
  }
}
